<?php /*a:2:{s:57:"/www/wwwroot/yinglinet.cn/app/admin/view/login/login.html";i:1699525238;s:57:"/www/wwwroot/yinglinet.cn/app/admin/view/base/unitjs.html";i:1699343568;}*/ ?>
<!--
 * @Author: 持禅 1791106511@qq.com
 * @Date: 2023-11-09 17:38:12
 * @LastEditors: 持禅 1791106511@qq.com
 * @LastEditTime: 2023-11-09 17:38:51
 * @FilePath: \菜瓜子3-代付-跳小程序付款c:\Users\Administrator\AppData\Local\Temp\fz3temp-3\login.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title><?php echo _doadminName; ?></title>
		<!-- 样 式 文 件 -->
		<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
		<link rel="stylesheet" href="/static/admin/css/other/login.css" />
	</head>
    <!-- 代 码 结 构 -->
	<body background="/static/admin/images/background.svg" style="background-size: cover;">
		<form class="layui-form" action="javascript:void(0);" id="formId">
			<div class="layui-form-item">
				<img class="logo" src="/static/admin/images/logo.png" />
				<div class="title"><?php echo _doadminName; ?></div>
				<div class="desc">
					小程序后台
				</div>
			</div>
			<div class="layui-form-item">
				<input placeholder="账 户 :  " autocomplete="off" spellcheck="false" name="username" lay-verify="required" hover class="layui-input"  />
			</div>
			<div class="layui-form-item">
				<input placeholder="密 码 :  "  type="password" autocomplete="off" spellcheck="false" name="password" lay-verify="required" hover class="layui-input"  />
			</div>
			<div class="layui-form-item">
				<input placeholder="验证码 : " autocomplete="off" spellcheck="false"  name="code" hover  lay-verify="required" class="code layui-input layui-input-inline"  />
				<img src="<?php echo captcha_src(); ?>?time=<?php echo time(); ?>" style="width:115px;height:40px;" class="codeImage" onclick="ghYzm(this)" />
			</div>
			<!-- <div class="layui-form-item">
				<input type="checkbox" name="" title="记住密码" lay-skin="primary" checked>
			</div> -->
			<div class="layui-form-item">
				<button type="button" class="pear-btn pear-btn-success login" lay-submit lay-filter="login">
					登 入
				</button>
			</div>
		</form>
		<!-- 资 源 引 入 -->
        <script src="/static/user/js/jquery.min.js"></script>
		<script src="/static/component/layui/layui.js"></script>
		<script src="/static/component/pear/pear.js"></script>
		<script>
			localStorage.setItem("theme-color",1);
			//
              _time=<?php echo time(); ?>;
            function ghYzm(item){
                _time++;
                $(item).attr("src",`<?php echo captcha_src(); ?>?time=${_time}`);
            }
			layui.use(['form', 'button', 'popup'], function() {
				var form = layui.form;
				var button = layui.button;
				var popup = layui.popup;
				
                // 登录事件
				form.on('submit(login)', function(data) {
					
					// 登录逻辑
					
					// 登录过渡
					button.load({
						elem: '.login',
						time: 1500,
						done: function() {
                            var data = $("#formId");
                            postDatai("<?php echo url('login/dologin'); ?>",data).then(function(res){
                                if(res.code==200){
                                    popup.success(res.message, function() {
                                            location.href = "/admin/"
                                        
                                    });
                                    return;
                                }
                                layer.msg(res.message, {
                                    icon: 2,
                                    time: 1000
                                });

						    })
                        }
					})
					return false;
				});
			})
		</script>
        <script>








    //     参数解释  
    //  url 地址  
    //  data  数据  
    //  alt 进度提示内容  
    //  ins 0 手动处理返回信息  1 自动处理返回信息
    //     co[辅助alt  co = 0时  进度条默认关闭  co = 1时  手动关闭进度条及之后弹框的内容]


    //带文件提交
    function postDatai(url, form, alt = "", ins = 0) {
        var p = new Promise(function (resolve, reject) {
            var formData = new FormData(form[0]);
            $.ajax({
                url: url,
                type: 'POST',
                data: formData,
                dataType: 'json',
                async: true,
                processData: false,
                contentType: false,
                success: function (res) {
                    if (res.code == -1) {
                        layer.alert(res.msg, {
                            title: "提示",
                            closeBtn: 0,
                            yes: function () {
                                location.reload();
                            }
                        });
                        return;
                    }
                    if (!ins) {
                        resolve(res);
                        return;
                    }
                    layer.alert(res.msg, {
                        title: "提示",
                        closeBtn: 0,
                        yes: function () {
                            res.code == 200 ? location.reload() : layer.close(layer.index);
                            return;
                        }
                    });


                },
                error: function (e) {
                    var res = $.parseJSON(e.responseText);
                    layer.alert(res.message, {
                        title: '提示',
                        closeBtn: 0,
                    });
                },
                beforeSend: function () {
                    if (alt) {
                        layer.msg(alt, { icon: 16, shade: 0.4, time: false });
                    }

                },
                complete: function () {
                    if (alt) {
                        layer.close(layer.index);
                    }
                }

            });
        })
        return p;
    }




    //普通提交--整改
    function postData(url, data, alt = "", ins = 0, co = 0) {
        var p = new Promise(function (resolve, reject) {
            $.ajax({
                url: url,
                data: data,
                header: { 'content-type': 'application/json' },
                type: 'POST',
                dataType: 'json',
                responseType: 'text',
                success: function (res) {
                    if (res.code == -1) {
                        layer.alert(res.message, {
                            title: "提示",
                            closeBtn: 0,
                            yes: function () {
                                location.reload();
                            }
                        });
                        return;
                    }
                    if (!ins) {
                        resolve(res);
                        return;
                    }
                    layer.alert(res.message, {
                        title: "提示",
                        closeBtn: 0,
                        yes: function () {
                            res.code == 200 ? location.reload() : layer.close(layer.index);
                            return;
                        }
                    });
                },
                fail: function (res) {
                    console.log(res);

                },
                error: function (e) {
                    var res = $.parseJSON(e.responseText);
                    layer.alert(res.message, {
                        title: '提示',
                        closeBtn: 0,
                    });
                },
                beforeSend: function () {
                    if (alt) {
                        layer.msg(alt, { icon: 16, shade: 0.4, time: false });
                    }

                },
                complete: function () {
                    if (alt && co) {
                        layer.close(layer.index);
                    }
                }

            })

        })
        return p;
    }



    function getObjectURL(file) {
		var url = null;
		if (window.createObjectURL != undefined) { // basic
			url = window.createObjectURL(file);
		} else if (window.URL != undefined) { // mozilla(firefox)
			url = window.URL.createObjectURL(file);
		} else if (window.webkitURL != undefined) { // webkit or chrome
			url = window.webkitURL.createObjectURL(file);
		}
		return url;
	}
</script>
	</body>
</html>
